﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace DearlerPlatfrom.Core.Repository
{
    public interface IRepository<TEntity> where TEntity : class
    {
        Task<TEntity> DeleteAsync(TEntity entity);

        Task<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate);

        Task<List<TEntity>> GetListAsync();
        Task<List<TEntity>> GetListAsync(PageWithSortDto dto);
        IQueryable<TEntity> GetQueryable(PageWithSortDto dto);
        IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> predicate);

        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate);
        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate, string orderBy, int pageIndex = 10, int pageSize = 1);

        Task<TEntity> InsertAsync(TEntity entity);
        Task<TEntity> UpdateAsync(TEntity entity);
    }
}
